import { api } from '@/utils/request'

export interface ContactViewConfig {
  enable_contact_view_fee: string
  free_views_per_month: string
  price_per_view: string
  chat_message_mode: string
  chat_free_daily_limit: string
}

export interface UpdateContactViewConfig {
  enable_contact_view_fee?: boolean
  free_views_per_month?: number
  price_per_view?: number
  chat_message_mode?: 'free' | 'paid'
  chat_free_daily_limit?: number
}

export interface ApiResponse<T = any> {
  success: boolean
  message: string
  data: T
}

// 系统设置API
export const settingsApi = {
  // 获取联系方式查看配置
  getContactViewConfig: (): Promise<ApiResponse<ContactViewConfig>> => {
    return api.get('/contact-view/config')
  },

  // 更新联系方式查看配置
  updateContactViewConfig: (data: UpdateContactViewConfig): Promise<ApiResponse<ContactViewConfig>> => {
    return api.put('/contact-view/config', data)
  }
}
